#include <iostream>
#include <algorithm>

using namespace std;

const int N = 100010;
int n, k;
int g[N];

int main() {
    int res = N, sum = 0;
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> k;
    for (int i = 1; i <= n; ++i) {
        cin >> g[i];
    }
    for (int i = 1, j = 1; i <= n; ++i) {
        sum += g[i];
        if (sum >= k) {
            while (sum - g[j] >= k) {
                sum -= g[j];
                j++;
            }
            res = min(res, i - j + 1);
        }
    }
    if (res == N) {
        puts("0");
    } else {
        cout << res;
    }
    return 0;
}